// Copyright 2021 Google LLC
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//      http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ignore_for_file: unused_element
// ignore_for_file: non_constant_identifier_names

// AUTO GENERATED FILE, DO NOT EDIT.
//
// Generated by `package:ffigen`.
// ignore_for_file: type=lint
import 'dart:ffi' as ffi;

/// Bindings to src/webcrypto.h.
class WebCrypto {
  /// Holds the symbol lookup function.
  final ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
      _lookup;

  /// The symbols are looked up in [dynamicLibrary].
  WebCrypto(ffi.DynamicLibrary dynamicLibrary)
      : _lookup = dynamicLibrary.lookup;

  /// The symbols are looked up with [lookup].
  WebCrypto.fromLookup(
      ffi.Pointer<T> Function<T extends ffi.NativeType>(String symbolName)
          lookup)
      : _lookup = lookup;

  /// Function to lookup BoringSSL symbols based on index in the Sym enum.
  /// See src/symbols.yaml for details.
  ffi.Pointer<ffi.Void> webcrypto_lookup_symbol(
    int index,
  ) {
    return _webcrypto_lookup_symbol(
      index,
    );
  }

  late final _webcrypto_lookup_symbolPtr =
      _lookup<ffi.NativeFunction<ffi.Pointer<ffi.Void> Function(ffi.Int32)>>(
          'webcrypto_lookup_symbol');
  late final _webcrypto_lookup_symbol = _webcrypto_lookup_symbolPtr
      .asFunction<ffi.Pointer<ffi.Void> Function(int)>();
}
